<div class="row clearfix">
	<div class="col-md-7 column" >
		<table width="100%">
			<tr>
				<td align="left">
					<button class="btn btn-info" ng-click="createSelfSelect()">Add Stock</button>
				</td>
				<td align="right">
					<tm-pagination conf="pagiConf4SelfSelects"></tm-pagination>
				</td>
			</tr>
		</table>
		<div id="warningMsgForStock"></div>
		<table id="selfselecttable" class="table table-hover table-striped dataTable" role="grid">
			<thead>
				<tr role="row">
					<th style="white-space:nowrap;">Edit</th>
					<th style="white-space:nowrap;">Stock Code</th>
					<th style="white-space:nowrap;">Stock Name</th>
					<th style="white-space:nowrap;">Status</th>
                    <th style="white-space:nowrap;">Current Price</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat='selfSelect in selfSelects' ng-click="selectCurrentSelfSelect($index)" role="row">
					<td width="15%">
						<edit ng-Model="selfSelect" ng-show="showStockEdit && !selfSelect.id" 
							d-type="selfSelect" show-stock-edit="showStockEdit" master="master"><a>Edit</a></edit>
						<update ng-Model="selfSelect" ng-show="!showStockEdit && !selfSelect.id" 
							d-type="selfSelect" show-stock-edit="showStockEdit" master="master"><a>Update</a></update> 
						<cancel ng-Model="selfSelect" ng-show="!showStockEdit && !selfSelect.id" 
							d-type="selfSelect" show-stock-edit="showStockEdit" master="master"> | <a>Cancel</a></cancel>
						<delete ng-Model="selfSelect" delete-func="deleteSelfSelectById(selfSelect.id)"
							ng-show="selfSelect.id"><a>Delete</a></delete>
					</td>
					<td width="20%">
						<input type="text" ng-model="selfSelect.code" editable-stockcode
                            id='stock_code_{{selfSelect.code}}' class="inactive" readOnly maxlength="6" size="6"/>
					</td>
					<td width="20%">{{selfSelect.name}}</td>
					<td width="20%">{{selfSelect.statusName}}</td>
					<td width="20%">{{selfSelect.latestPrice}}</td>
					<td width="5%"><span class="glyphicon glyphicon-ok" ng-show="selectedIndex==$index"></span></td>
				</tr>
			</tbody>
		</table>
		<table width="100%">
			<tr>
				<td align="left">
					<button class="btn btn-info" ng-click="createSelfSelect()">Add Stock</button>
				</td>
				<td align="right">
					<tm-pagination conf="pagiConf4SelfSelects"></tm-pagination>
				</td>
			</tr>
		</table>
	</div>
	<div class="col-md-5 column" ng-show="selectedSelfSelect.id">
		<div class="page-header" style="margin:0px;">
			<h1>
				{{selectedSelfSelect.abbr}} <small>  {{selectedSelfSelect.code}}</small>
				<input type="hidden" id="selectedStockId" name="selectedStockId" value={{selectedSelfSelect.id}}>
			</h1>
		</div>
       	<div id="categoryTagMsg"></div>
		<div class="es-cat-tag-div" style="margin:15px 0px;">
			<span class="es-category-tag" ng-repeat='stockCategory in categoriesBySelfSelect'>
				<span ng-show="stockCategory.id" ng-class=tagClasses[$index%6]>
					<label style="font-size:12px;">{{stockCategory.name}}</label>
					<button class="btn estag_btn"><i class="fa fa-times"></i></button>
				</span>
				<span ng-show="!stockCategory.id">
					<input type="text" class="estag_input" size="12" ng-model="stockCategory.name" ng-blur="saveStockCategory()">
					<button class="btn estag_btn"><i class="fa fa-times"></i></button>
				</span>
				&nbsp;&nbsp;
				<input type="hidden" id="selectedStockCategoryId" name="selectedStockCategoryId" value={{stockCategory.id}}>
			</span>
			<button type="button" class="btn btn-default btn-sm" ng-click="createStockCategory()" ng-show="true">
				<span class="glyphicon glyphicon-plus"></span>
			</button>
		</div>
		<div class="box">
			<div class="box-header">
				<h3 class="box-title">Company Summary</h3> <a href="">详细信息</a>
            </div><!-- /.box-header -->
            <div class="box-body no-padding">
            	            	<table class="table table-bordered">
                	<tbody>
                    	<tr>
                      		<td width="75%">Main Business Area</td>
                      		<td width="25%">Industry</td>
                    	</tr>
                    	<tr>
                      		<td>电真空玻璃器件及其配套电子元器件的生产与销售和平板显示玻璃基板及其装备的研发、生产与销售等</td>
                      		<td>
                      			<div class="small-box">
                					光学光电子	
   								</div>
              				</td>
                    	</tr>
                    	<tr>
                      		<td colspan="2">Concepts Involved: 证金持股, 融资融券, 蓝宝石, 石墨烯</td>
                    	</tr>
                  	</tbody>
                </table>
                <table class="table table-condensed">
                	<tbody>
                    	<tr>
                      		<td>PE(Dynamic)</td>
                      		<td><span class="badge direct-chat-text">23.17</span></td>
                      		<td>EPS</td>
                      		<td><span class="badge bg-yellow">0.16</span>元</td>
                    	</tr>
                    	<tr>
                      		<td>PE(Static)</td>
                      		<td>22.79</td>
                      		<td>每股净资产</td>
                      		<td><span class="badge bg-green">2.48</span>元</td>
                    	</tr>
                    	<tr>
                      		<td>市净率</td>
                      		<td><span class="badge bg-green">3.04</span></td>
                      		<td>净资产收益率</td>
                      		<td>6.64%</td>
                    	</tr>
                    	<tr>
                      		<td>营业收入</td>
                      		<td>14.47亿元</td>
                      		<td>净利润</td>
                      		<td>4.33亿元</td>
                    	</tr>
                    	<tr>
                      		<td>每股现金流</td>
                      		<td>0.03元</td>
                      		<td>总股本</td>
                      		<td>26.62亿股</td>
                    	</tr>
                    	<tr>
                      		<td>分类</td>
                      		<td><span class="badge bg-green">大盘股</span></td>
                      		<td>流通A股</td>
                      		<td><span class="badge bg-green">20.19</span>亿股</td>
                    	</tr>
                  	</tbody>
                </table>
			</div><!-- /.box-body -->
		</div>
	</div>
</div>

<script>
  $(function () {
	$('.es-cat-tag-div').on('click', '.estag_btn', function () {
		$(this).parent().css('display','none');
		// delete
		var selectedStockCategoryId = $(this).parent().parent().find('#selectedStockCategoryId').val();
		var selectedStockId = $('#selectedStockId').val();
		$.get(
			"deleteStockCatRelate.es", 
			{
			 stockCategoryId:selectedStockCategoryId, 
			 stockId:selectedStockId
			},
			function(data) //回传函数
			{
			    //
		    }
	    );
	});
  });
</script>